<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>求职者主页</title>
    <style>
        #opea {
            display: none;
        }
    </style>
    <script src="../js/commons.js"></script>
    <script src="../js/jquery-3.6.0.js"></script>
</head>
<body>
<div id="title">

</div>
<div id="opea">
    <a href="addresume.html">创建简历</a><br>
    <a href="addCompany.html">创建企业</a>

</div>
<!--工作推荐-->
<div>

</div>


<script>
    $.ajax({
        url: URL + "user/info",
        headers: {"token":localStorage.getItem("token")},

        success: function (result){
            if (result.code == 2){
                alert(result.msg);
                window.location.href = "login.html";
            } else if (result.code == 0){ // 查询成功
                let activeUser = result.data;

                if (activeUser.roles && activeUser.roles.length > 0){ // []
                    for (let i = 0 ; i < activeUser.roles.length;i++){


                        if (activeUser.roles[i].rid == 1){
                            window.location.href = "http://localhost:63342/zhaopin61/web/seeker/html/main.html";
                        }
                        if (activeUser.roles[i].rid == 2){
                            window.location.href = "../zhaopin/index.html";
                        }
                        if (activeUser.roles[i].rid == 3){
                            window.location.href = "";
                        }
                    }


                } else {//没有角色信息

                }
            } else { // 查询失败

            }
        }
    })
</script>
</body>
</html>